<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    	<title>叮咚老师-绑定园所</title>
        
        <!-- 引入 WeUI -->
        <link rel="stylesheet" href="<?php echo base_url()?>/public/assets/css/weui.css"/>
        <link rel="stylesheet" href="<?php echo base_url()?>/public/assets/css/font-awesome.css">
        <link rel="stylesheet" type="text/css" href="<?php echo base_url()?>public/assets/css/h5/bind.css">
        <script type="text/javascript" src="<?php echo base_url()?>/public/assets/js/jquery.min.js"></script>
        
    </head>
    <body>


<div class="contain" id="nursery" style="display: block;">
    <p class="current">
    当前城市：<label id=""><?php echo $area_title?></label>&nbsp;&nbsp;<label id=""><?php echo $city_title?></label>
    <a href="<?php echo base_url()?>bind/area" class="change">切换</a>
    </p>
    
    <div class="weui_cells_title" style="font-size:16px;">就近园区</div>
    
    <div class="weui_cells_title" style="font-size: 16px;"></div>
    
    <?php if(!$nursery_info){?>
    <div class="weui_cells weui_cells_radio">
        <label class="weui_cell weui_check_label">
            <div class="weui_cell_bd weui_cell_primary" style="margin-left: 40%">
                <p>暂无园所</p>
            </div>
        </label>
    </div>
    <?php }else{?>
    <div class="weui_cells weui_cells_radio">
        <?php foreach ($nursery_info as $k=>$v){?>
        <label class="weui_cell weui_check_label">

            <div class="weui_cell_bd weui_cell_primary">
                <p><?php echo $v['title']?></p>
                <p>地址：<?php echo $v['address']?></p>
                <p>支持<?php echo $v['address']?>半径5公里范围内上课</p>
            </div>
            <div class="weui_cell_ft">
                <input <?php echo $k==0 ? 'checked' : ''?> ntitle="<?php echo $v['title']?>" type="radio" name="radio1" value="<?php echo $v['id']?>" class="weui_check" />
                <span class="weui_icon_checked"></span>
            </div>
        </label>
        <?php }?>
    </div>
    <?php }?>
    
    <a id="ok_btn" href="javascript:void(0);" class="weui_btn weui_btn_plain_primary" >确定</a>
</div>

<!-- 
<div class="contain" id="change">
    <p class="current">
    当前城市：<label id=""><?php #echo $area_title?></label>&nbsp;&nbsp;<label id=""><?php #echo $city_title?></label>
    <a href="<?php #echo base_url()?>bind/area" class="change">切换</a>
    </p>
    
    <p class="current">就近园区：<label id="nlabel"></label>
    <a href="javascript:void(0);" id="nqh"  class="change">切换</a>
    </p>
    <a id="save_btn" href="javascript:void(0);" class="weui_btn weui_btn_plain_primary" >保存</a>
</div>
 -->

<script type="text/javascript">
    $(document).ready(function(){
    	$("#nursery label").click(function(){
            var title = $('[name="radio1"]:checked').attr('ntitle');
            $("#nlabel").text(title);
        });

        $("#nursery label:eq(0)").click();
    });

    $("#ok_btn").click(function(){
//         $("#nursery").hide();
//         $("#change").show();
    	$.ajax({
    	    type: "POST",
    	    url: '<?php echo base_url()?>bind/change',
    	    data: {'nid': $('[name="radio1"]:checked').val()},
    	    success: function (data) {
	            location.href = '<?php echo base_url();?>';
    	    }
    	});
    });

//     $("#nqh").click(function(){
//         $("#nursery").show();
//         $("#change").hide();
//     });

//     $("#save_btn").click(function(){
//     	$.ajax({
//     	    type: "POST",
//    	    url: '<?php #echo base_url()?>bind/change',
//     	    data: {'nid': $('[name="radio1"]:checked').val()},
//     	    success: function (data) {
//	            location.href = '<?php #echo base_url();?>';
//     	    }
//     	});
//     });

    
</script>

</body>
</html>